<style>
    *{
        padding: 0;
        margin: 0;
    }
</style>
<style scoped lang="scss">
    $header-height:60px;
    $background-color: #545c64;
    $color: #FFF;

    .main{
        height: 100vh;
        min-width: 800px;
        min-height: 600px;
        overflow: hidden;

        aside{
            overflow: visible;
            height: 100%;
            background-color: $background-color;
            color: $color;

            .isClossTab{
                width: 100%;
                height: $header-height;
                cursor: pointer;
                font-size: 25px;
                text-align: center;
                line-height: $header-height;
                font-weight: bold;
                border-right: 1px solid #807c7c;
                box-sizing: border-box;
            }
            .menu {
                width: 100%;
                border-right:0;


            }

        }

        .main-header-user {
            background-color: $background-color;
            color: $color;

            .el-dropdown{
                cursor: pointer;
                float: right;
            }
            .el-dropdown-link{

                img{
                    $imgMargin: (($header-height - 50)/2);
                    display:inline-block;
                    width:50px;
                    height: 50px;
                    border-radius: 25px;
                    background-color: #FFF;
                    margin-top: $imgMargin;
                }
            }
        }

        .main-header-companyinfo {
            background-color: $background-color;
            color: $color;
            line-height: $header-height;
            font-size: larger;
            font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
        }

        .crumbs {
            margin-bottom: 20px;
        }

        .main-footer{
            text-align: center;
            background-color: $background-color;
            color: $color;
            line-height: 50px;
        }

    }

</style>

<template>
    <div>
        <el-container class="main">
            <el-aside :width="tabWidth+'px'">
                <div>
                    <div class="isClossTab" @click="isClossTabFun">
                        <i :class="isCollapse?'el-icon-d-arrow-right':'el-icon-d-arrow-left'" ></i>
                    </div>
                    <el-menu :class="'menu'"
                             default-active="1-4-1"
                             class="el-menu-vertical-demo"
                             @open="handleOpen"
                             @close="handleClose"
                             :collapse="isCollapse"
                             background-color="#545c64"
                             text-color="#fff"
                             active-text-color="#ffd04b"
                    >
                        <el-submenu index="1">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span slot="title">产品管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item v-for="(item,i) in navList" :key="i" :index="item.name">
                                    {{ item.navItem }}
                                </el-menu-item>
                                <el-menu-item index="1-1"><router-link to="/productcardlist">产品列表</router-link></el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="2">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span slot="title">秒杀管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="2-1">秒杀活动列表</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                    </el-menu>
                </div>
            </el-aside>
            <el-container>
                <el-row>
                    <el-col :span="12">
                        <el-header class="main-header-companyinfo">
                            咸宁市伊丽源美容美体俱乐部拓客后台管理系统
                        </el-header>
                    </el-col>
                    <el-col :span="12">
                        <el-header class="main-header-user">
                        <el-dropdown>
                        <span class="el-dropdown-link">
                        <img src="" alt="">
                        </span>
                        <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item>退出登录</el-dropdown-item>
                        </el-dropdown-menu>
                        </el-dropdown>
                        </el-header>
                    </el-col>
                </el-row>
                <el-main>
                    <el-breadcrumb separator="/" class="crumbs">
                        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                        <el-breadcrumb-item>活动管理</el-breadcrumb-item>
                        <el-breadcrumb-item>活动列表</el-breadcrumb-item>
                        <el-breadcrumb-item>活动详情</el-breadcrumb-item>
                    </el-breadcrumb>
                    <transition>
                        <router-view></router-view>
                    </transition>
                </el-main>
                <el-footer class="main-footer" height="50px">
                    <p>页脚</p>
                </el-footer>
            </el-container>
        </el-container>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                isCollapse: false,
                tabWidth: 200,
                test1: 1,
                intelval: null,
            };
        },
        methods: {
            handleOpen(key, keyPath) {
                console.log(key, keyPath);
            },
            handleClose(key, keyPath) {
                console.log(key, keyPath);
            },

            isClossTabFun(){
                clearInterval(this.intelval);
                if(!this.isCollapse){
                    this.intelval = setInterval(()=>{
                        if(this.tabWidth<= 64)
                            clearInterval(this.intelval);
                        this.tabWidth -= 1;
                    }, 1);
                }else{
                    this.tabWidth = 200;
                }
                this.isCollapse = !this.isCollapse;
            }
        },
        beforeCreate(){
        }
    }
</script>